package com.zhao.demo.service.impl;

import com.zhao.demo.dao.UserDao;
import com.zhao.demo.pojo.User;
import com.zhao.demo.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author xiaoZhao
 * @date 2022/7/24
 * @describe
 */
@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public List<User> getUserList() {
        return userDao.selectList(null);
    }

    @Override
    public User getUserById(Integer id){
        return userDao.selectById(id);
    }

    @Override
    public int addUser(User user){
        return  userDao.insert(user);
    }

    @Override
    public int updateUser(User user){
        return  userDao.updateById(user);
    }

    @Override
    public int deleteUser(Integer id){
        return  userDao.deleteById(id);
    }

}
